/**
 * 
 */
package com.demo2do.boyle.common.dao;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.demo2do.boyle.common.entity.system.tag.Tag;
import com.demo2do.boyle.common.entity.system.tag.Type;
import com.demo2do.core.persistence.GenericDaoSupport;

/**
 * @author downpour
 *
 */
@Repository("tagDaoSupport")
public class TagDaoSupport {
	
	@Autowired
	private GenericDaoSupport genericDaoSupport;
	
	/**
	 * List tags by type
	 * 
	 * @param type
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public List<Tag> list(Type type) {
		return genericDaoSupport.searchForCacheableList("FROM Tag tag WHERE tag.disabled = false AND tag.type = :type", "type", type);
	}

}
